package com.qcxk.yuqian.rtu.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.qcxk.yuqian.rtu.entity.Channel;
import com.qcxk.yuqian.rtu.mapper.ChannelMapper;
import com.qcxk.yuqian.rtu.service.IChannelService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import com.qcxk.yuqian.system.component.QueryWrapperConverter;

/**
 * @auther lp
 * @create 2021-11-15 03:19:19
 * @describe 服务实现类
 */
@Service
public class ChannelServiceImpl extends ServiceImpl<ChannelMapper, Channel> implements IChannelService {
    @Autowired
    private ChannelMapper channelMapper;

    @Override
    public Page queryChannelPage(Page page, Channel channel) {

        QueryWrapper<Channel> channelQueryWrapper = new QueryWrapper<>();
//        QueryWrapperConverter.converter(channelQueryWrapper,channel);
//
//        channelQueryWrapper.orderByDesc("ctime");
        channelQueryWrapper.ne("id", 999999);
        channelMapper.selectPage(page, channelQueryWrapper);
        return page;
    }

    @Override
    public boolean deleteChannelById(Channel channel) {
        int re = channelMapper.deleteById(channel.getId());
        return re == 1 ? true : false;
    }
}
